import apibase from "@/api/apiBase";
import axios from "axios";
import { discountRemoveInterface, discountSaveInterface, discountUpdateInterface, grantedListInterface, grantListInterface, userGetListInterface, userRechargeInterface } from "./user.interface";
//获取用户列表
export const $userGetList = (params: userGetListInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/user/getList',
    data: params,
    instance,
  });
}
//账户充值
export const $userRecharge = (params: userRechargeInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/user/recharge',
    data: params,
    instance,
  });
}

//已配置折扣的产品列表
export const $grantedList = (params: grantedListInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/user-product-discount/grantedList',
    data: params,
    instance,
  });
}

//未配置折扣的产品列表
export const $grantList = (params: grantListInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/user-product-discount/grantList',
    data: params,
    instance,
  });
}

//设置用户的产品折扣
export const $discountSave = (params: discountSaveInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/user-product-discount/save',
    data: params,
    instance,
  });
}

//修改用户的产品折扣率
export const $discountUpdate = (params: discountUpdateInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/user-product-discount/update',
    data: params,
    instance,
  });
}

//删除用户的产品折扣率的配置
export const $discountRemove = (params:discountRemoveInterface) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/user-product-discount/remove',
    data: params,
    instance,
  });
}